/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.srcptit.trainning.luyennv.btvn1;

import java.util.Scanner;

/**
 *
 * @author Nhim
 */
public class Bai3 {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int n = input.nextInt();
        Phantich(n);
    }
    public static void Phantich(int n){
        int dem;
        int m = (int)Math.sqrt(n);
        for(int i = 2; i <= m; i++){
            dem = 0;
            if(n % i == 0){
                while(n % i == 0){
                    n = n / i;
                    dem++;
                }
            }
            if(dem != 0) System.out.println(i+" "+ dem);
            m = (int)Math.sqrt(n);
        }
        if(n > 1) System.out.println(n+" "+1);
    }
}
